home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230S / SESSMGR.H < prev    next >
C/C++ Source or Header  |  1997-05-24  |  5KB  |  100 lines

  1. /*
  2.  * Session manager interface
  3.  *
  4.  * NOS uses several functions to interface with the outside world (not
  5.  * including printf, which I'm trying to stomp out).  These were originally
  6.  * called directly.
  7.  *
  8.  * The JNOS session manager translates calls to these functions into calls
  9.  * through a "session manager switch".  This switch is an array of pointers to
  10.  * session manager definitions, including a session manager name and a series
  11.  * of function pointers.  Each session has a pointer to its session manager
  12.  * definition taken from the session manager switch, and a pointer to data
  13.  * which is specific to (and only known to) the session manager.
  14.  *
  15.  * There are several internal session managers:
  16.  *
  17.  * none
  18.  *    All session manager operations are mapped to null functions except
  19.  *    the keyboard, which maps to a function that never returns.  Used from
  20.  *    /etc/rc.  Remappable.
  21.  *    (Not yet present.  Without external sessions, this one is fatal...)
  22.  *
  23.  * dumb
  24.  *    No screen or keyboard operations; suitable for use as a pipe (!) or
  25.  *    file output.  Remappable.  (This one may not stay; it's intended more
  26.  *    for debugging and experimentation with the session manager than for
  27.  *    any practical use.)
  28.  *
  29.  * raw
  30.  *    Uses raw terminfo for built-in operations, passes everything else to
  31.  *    the actual terminal.  Another testing one.
  32.  *    (Present but not tested:  ncurses has bugs in its terminfo-only
  33.  *    interface.  May test this under SCO.)
  34.  * 
  35.  * curses
  36.  *    The "original" session interface.
  37.  *
  38.  * ansi
  39.  *    A modified "curses" with ANSI-X3.64 and PC line graphics support.
  40.  *    (This will become a per-session option to "curses".)
  41.  *
  42.  * I intend to provide an "xterm" interface, which spawns slave xterms for its
  43.  * sessions.
  44.  *
  45.  * The "wherex" and "wherey" entries are a problem for externally located
  46.  * sessions, not to mention the "none" and "dumb" session managers.  They are
  47.  * only used with split sessions.
  48.  *
  49.  * This is *not* the external session manager, which is a different entity
  50.  * entirely.  The external session manager is a JNOS task which waits for
  51.  * connections on a (Unix-domain or possibly IP) system socket and spawns
  52.  * sessions whose I/O is mapped to the outside connection.  To map the I/O,
  53.  * the external session manager will use a private session manager definition
  54.  * (not present in the session manager switch), so this is a prerequisite for
  55.  * external sessions... but this does not in and of itself enable external
  56.  * sessions.  (External sessions also have headaches of their own:  the trace
  57.  * and command sessions.  More later, when I tackle external sessions.)
  58.  */
  59.  
  60. struct sessmgr_sw
  61. {
  62.     const char *name;
  63.     int flags;
  64. #define SM_SPLIT    0x01    /* can handle split sessions */
  65. #define SM_STDIO    0x02    /* multiplexed on stdin/stdout */
  66. #define SM_SUSPEND    0x04    /* internal: suspended mpx'ed session */
  67. #define SM_INIT        0x08    /* has been initialized */
  68. #define SM_FIXED    0x10    /* can't change session managers */
  69. #define SM_LOCK        0x20    /* I/O locked to avoid reentrancy problems */
  70.     int (*init) (const struct sessmgr_sw *);
  71.     char *(*options) (const struct sessmgr_sw *, char *);
  72.     void *(*create) (const struct sessmgr_sw *, struct session *);
  73.     char *(*sessopt) (const struct sessmgr_sw *, void *, const char *);
  74.     int (*swtch) (const struct sessmgr_sw *, void *, void *);
  75.     void (*putch) (const struct sessmgr_sw *, void *, int);
  76.     void (*clreol) (const struct sessmgr_sw *, void *);
  77.     void (*clrscr) (const struct sessmgr_sw *, void *);
  78.     int (*wherex) (const struct sessmgr_sw *, void *);
  79.     int (*wherey) (const struct sessmgr_sw *, void *);
  80.     void (*window) (const struct sessmgr_sw *, void *, int, int, int,
  81.                int);
  82.     void (*gotoxy) (const struct sessmgr_sw *, void *, int, int);
  83.     void (*high) (const struct sessmgr_sw *, void *);
  84.     void (*norm) (const struct sessmgr_sw *, void *);
  85.     void (*bground) (const struct sessmgr_sw *, void *, int);
  86.     void (*fground) (const struct sessmgr_sw *, void *, int);
  87.     void (*txtattr) (const struct sessmgr_sw *, void *, int);
  88.     void (*refresh) (const struct sessmgr_sw *, void *);
  89.     void (*cursor) (const struct sessmgr_sw *, void *, int);
  90.     int (*kbread) (const struct sessmgr_sw *, void *);
  91.     void (*destroy) (const struct sessmgr_sw *, void *);
  92.     void (*status) (const struct sessmgr_sw *, void *, int, char *);
  93.     void (*rflush) (const struct sessmgr_sw *, void *);
  94.     void (*flush) (const struct sessmgr_sw *, void *);
  95.     void (*suspend) (const struct sessmgr_sw *);
  96.     void (*resume) (const struct sessmgr_sw *);
  97.     void (*end) (const struct sessmgr_sw *);
  98.     int refcnt;
  99. };
  100.